package yf.mall.vo.down;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import yf.mall.enums.AccountRecordBusEnum;
import yf.mall.enums.AccountTypeEnum;
import yf.mall.vo.AccountRecordVo;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class AccountRecordDownVO {

    @ExcelProperty("转账人")
    private String fromUserName;

    @ExcelProperty("转账人手机")
    private String fromUserMobile;

    @ExcelProperty("到账人")
    private String toUserName;

    @ExcelProperty("到账人手机")
    private String toUserMobile;

    @ExcelProperty("类型")
    private String type;

    @ExcelProperty("数量")
    private BigDecimal amount;

    @ExcelProperty("详情")
    private String info;

    @ExcelProperty("时间")
    private Date date;

    @ExcelProperty("业务")
    private String bus;

    public AccountRecordDownVO(AccountRecordVo recordVo) {
       this.fromUserName = recordVo.getFromUser().getName();
       this.fromUserMobile = recordVo.getFromUser().getMobile();
       this.toUserName = recordVo.getToUser().getName();
       this.toUserMobile = recordVo.getToUser().getMobile();
       this.type = AccountTypeEnum.indexOf(recordVo.getRecord().getType());
       this.bus = AccountRecordBusEnum.indexOf(recordVo.getRecord().getBus());
       this.date = recordVo.getRecord().getTime();
       this.amount = recordVo.getRecord().getAmount();
       this.info = recordVo.getRecord().getInfo();
    }
}
